﻿@{
	var labelName = PageData["labelName"];
	var labelDisplay = PageData["labelDisplay"];
	var inputType = PageData["inputType"] ?? "text";
    var inputValue = PageData["inputValue"];
	var required = PageData["required"];
	var validationClasses = PageData["validationClasses"];
	if (required) {
		validationClasses = "required " + validationClasses;
	}
	var validationAttributes = new HtmlString(PageData["validationAttributes"]);
    var maxLength = PageData["maxLength"];
    var disabled = false;
    if(PageData["disabled"]!=null) {
        disabled = PageData["disabled"];
    }
}
@if (inputType.ToLowerInvariant() == "checkbox") {
    <div class="editor-field">
	@if (inputValue.ToLowerInvariant() == "true") {
		<input id="@labelName" @if(disabled){<text>disabled</text>}  name="@labelName" value="true" checked type="@inputType" />
	} else {
		<input id="@labelName" @if(disabled){<text>disabled</text>} name="@labelName" value="true" type="@inputType" />
	}
    <label for="@labelName">@labelDisplay</label>
</div>
} else {
    <div class="editor-label">
	    <label for="@labelName">@labelDisplay</label>
    </div>
    <div class="editor-field">
	<input id="@labelName"  @if(disabled){<text> disabled </text>}  @if(required){<text>class="@validationClasses"</text>} name="@labelName" @validationAttributes value="@inputValue" type="@inputType" @if(maxLength!=null){<text>maxlength="@maxLength"</text>} />
	@if (required) {
		<em>*</em>
	}
    </div>
}